import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'


import AdminLogin from '../views/AdminLogin.vue'
import AdminLayout from '../views/adminLayout'
import AdminHome from '../views/AdminHome.vue'
import Admin from '../views/Admin.vue'
import Network from '../views/Network.vue'
import Courier from '../views/Courier.vue'
import User from '../views/User.vue'
import Order from '../views/Order.vue'
import Deliver from '../views/Deliver.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '',
        component: () => import('../components/user_cpn/home.vue')
      },
      {
        path: 'Workplace',
        component: () => import('../components/user_cpn/workplace.vue'),
        children: [
          {
            path: '',
            component: () => import('../components/user_cpn/workplace/sendexpress.vue')
          },
          {
            path: 'searchexpress',
            component: () => import('../components/user_cpn/workplace/searchexpress.vue'),
            children: [
              {
                path: '',
                component: () => import('../components/user_cpn/workplace/searchexpress_cpn/send.vue')
              },
              {
                path: 'get',
                component: () => import('../components/user_cpn/workplace/searchexpress_cpn/get.vue')
              },
            ]
          },
          {
            path: 'searchnode',
            component: () => import('../components/user_cpn/workplace/searchnode.vue')
          },
          {
            path: 'message',
            component: () => import('../components/user_cpn/workplace/message.vue')
          },
          {
            path: 'addressbook',
            component: () => import('../components/user_cpn/workplace/addressbook.vue')
          },]
      },
    ]
  },
  {
    path: '/Adlogin',
    name: 'admin_login',
    component: () => import('../views/Login.vue')
  },

  {
    path: '/adminLogin',
    name: 'AdminLogin',
    component: AdminLogin
  },
  {
    path: '/adminHome',
    component: AdminLayout,
    children: [
      {
        path: '',
        name: 'AdminHome',
        component: AdminHome
      },
      {
        path: '/admin',
        name: 'Admin',
        component: Admin
      },
      {
        path: '/network',
        name: 'Network',
        component: Network
      },
      {
        path: '/courier',
        name: 'Courier',
        component: Courier
      },
      {
        path: '/user',
        name: 'User',
        component: User
      },
      {
        path: '/order',
        name: 'Order',
        component: Order
      },
      {
        path: '/deliver',
        name: 'Deliver',
        component: Deliver
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
